package com.itany.shop.service;

import com.itany.shop.entity.User;
import com.itany.shop.exception.*;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.servlet.ServletFileUpload;

import javax.servlet.http.HttpSession;

/**
 * @author 石小俊
 * @date 2023年07月05日 16:55
 */
public interface UserService {

    /**
     * 用户注册
     * @param username  用户名,具有唯一性
     * @param password
     * @param phone
     * @param address
     */
    public void register(String username,String password,String phone,String address) throws RequestParameterErrorException, UserExistException;

    /**
     * 用户注册
     * @param username
     * @param password
     * @param phone
     * @param address
     * @param file
     * @throws RequestParameterErrorException
     * @throws UserExistException
     */
    public void register(String username, String password, String phone, String address, FileItem file, HttpSession session) throws RequestParameterErrorException, UserExistException, FileUploadErrorException;

    /**
     * 用户登录
     * @param username  用户名
     * @param password  密码,使用MD5进行加密
     * @param code      用户输入的验证码
     * @param image     验证码图片的内容
     * @return
     */
    public User login(String username,String password,String code,String image) throws RequestParameterErrorException, CodeErrorException, UserNotExistException;
}
